/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Microsoft YaHei', sans-serif;
}

body {
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: #333;
}

button {
    cursor: pointer;
}

/* 头部样式 */
header {
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.top-bar {
    display: flex;
    justify-content: space-between;
    padding: 8px 20px;
    background-color: #f8f8f8;
    font-size: 14px;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
}

.logo {
    font-size: 28px;
    font-weight: bold;
    color: #4a934a;
}

.search-box {
    flex-grow: 0.5;
    margin: 0 20px;
}

.search-box input {
    width: 80%;
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
}

.search-box button {
    padding: 8px 15px;
    background-color: #4a934a;
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
}

.cart-icon a {
    display: flex;
    align-items: center;
    color: #4a934a;
    font-weight: bold;
}

nav ul {
    display: flex;
    list-style: none;
    padding: 15px 20px;
    background-color: #4a934a;
}

nav ul li {
    margin-right: 20px;
}

nav ul li a {
    color: white;
    font-weight: bold;
}

/* 轮播图样式 */
.slider {
    position: relative;
    height: 400px;
    overflow: hidden;
    margin-bottom: 15px;
}

.slides {
    height: 100%;
    position: relative;
}

.slides img {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.slides img.active {
    opacity: 1;
}

.slider-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
}

.slider-controls span {
    width: 12px;
    height: 12px;
    margin: 0 5px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
}

.slider-controls span.active {
    background-color: white;
}

/* 商品分类样式 */
.category {
    padding: 20px;
    background-color: white;
    margin: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.category h2 {
    margin-bottom: 20px;
    color: #4a934a;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.product-card {
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.product-card:hover {
    transform: translateY(-5px);
}

.product-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.product-card h3 {
    padding: 10px 15px;
    font-size: 16px;
}

.product-card .price {
    padding: 0 15px 10px;
    color: #e74c3c;
    font-weight: bold;
}

.add-to-cart {
    display: block;
    width: 100%;
    padding: 10px;
    background-color: #4a934a;
    color: white;
    border: none;
    transition: background-color 0.3s ease;
}

.add-to-cart:hover {
    background-color: #3a7a3a;
}

/* 登录/注册页面样式 */
.auth-container {
    max-width: 500px;
    margin: 50px auto;
    padding: 40px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.auth-container h2 {
    margin-bottom: 30px;
    text-align: center;
    color: #4a934a;
    font-size: 24px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    border-color: #4a934a;
    outline: none;
}

.auth-btn {
    width: 100%;
    padding: 14px;
    background-color: #4a934a;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

.auth-btn:hover {
    background-color: #3a7a3a;
}

.auth-switch {
    text-align: center;
    margin-top: 25px;
    color: #666;
}

.auth-switch a {
    color: #4a934a;
    font-weight: bold;
    margin-left: 5px;
}

/* 错误提示样式 */
.error-message {
    color: #e74c3c;
    font-size: 14px;
    margin-top: 5px;
    display: none;
}

/* 页脚样式 */
footer {
    background-color: #333;
    color: #fff;
    padding: 30px 0;
    text-align: center;
    margin-top: 50px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-content p {
    margin-bottom: 10px;
    color: #ccc;
}

/* 商品详情页样式 */
.product-detail {
    display: flex;
    padding: 30px;
    background-color: white;
    margin: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.product-image {
    flex: 1;
    padding-right: 30px;
}

.product-image img {
    width: 100%;
    max-height: 500px;
    object-fit: contain;
}

.product-info {
    flex: 1;
}

.product-title {
    font-size: 24px;
    margin-bottom: 10px;
}

.product-price {
    font-size: 28px;
    color: #e74c3c;
    margin-bottom: 20px;
}

.product-description {
    margin-bottom: 30px;
    line-height: 1.8;
}

.quantity-selector {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.quantity-selector button {
    width: 40px;
    height: 40px;
    background-color: #f0f0f0;
    border: none;
    font-size: 18px;
}

.quantity-selector input {
    width: 60px;
    height: 40px;
    text-align: center;
    border: 1px solid #ddd;
    margin: 0 10px;
}

/* 购物车样式 */
.cart-container {
    padding: 30px;
    background-color: white;
    margin: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.cart-item {
    display: flex;
    padding: 20px 0;
    border-bottom: 1px solid #eee;
}

.cart-item-image {
    width: 100px;
    height: 100px;
    margin-right: 20px;
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-info {
    flex: 1;
}

.cart-item-title {
    font-weight: bold;
    margin-bottom: 5px;
}

.cart-item-price {
    color: #e74c3c;
    margin-bottom: 10px;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
}

.cart-item-quantity button {
    width: 30px;
    height: 30px;
    background-color: #f0f0f0;
    border: none;
}

.cart-item-quantity input {
    width: 50px;
    height: 30px;
    text-align: center;
    border: 1px solid #ddd;
    margin: 0 5px;
}

.cart-item-remove {
    color: #e74c3c;
    cursor: pointer;
}

.cart-summary {
    margin-top: 30px;
    text-align: right;
}

.cart-total {
    font-size: 24px;
    margin-bottom: 20px;
}

.checkout-btn {
    padding: 12px 30px;
    background-color: #4a934a;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    transition: background-color 0.3s ease;
}

.checkout-btn:hover {
    background-color: #3a7a3a;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-header {
        flex-direction: column;
    }
    
    .search-box {
        width: 100%;
        margin: 15px 0;
    }
    
    .slider {
        height: 250px;
    }
    
    .product-detail {
        flex-direction: column;
    }
    
    .product-image {
        padding-right: 0;
        margin-bottom: 20px;
    }
}

input.error {
    border-color: #ff4d4f;
    box-shadow: 0 0 0 2px rgba(255, 77, 79, 0.2);
}

.auth-btn:disabled {
    background-color: #d9d9d9;
    cursor: not-allowed;
}